package com.zygh.interactiveplatform.module.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zygh.interactiveplatform.common.domain.ResponseDTO;
import com.zygh.interactiveplatform.module.entity.V1RestrictionAlgorithm;
import com.zygh.interactiveplatform.module.mapper.V1RestrictionAlgorithmMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author lee
 * @since 2021-02-27
 */
@Service
@DS("postgresql")
public class V1RestrictionAlgorithmServiceImpl extends ServiceImpl<V1RestrictionAlgorithmMapper, V1RestrictionAlgorithm> {
    @Resource
    private V1RestrictionAlgorithmMapper v1RestrictionAlgorithmMapper;

    public ResponseDTO illegalVehicle() {
        int count = 0;
        List<String> list = v1RestrictionAlgorithmMapper.illegalVehicle();
        for (int i = 0; i < list.size(); i++) {
            int num = Integer.parseInt(list.get(i));
            count += num;
        }
        return ResponseDTO.succData(count);
    }
}
